<%@page import="Pessoas.Usuario"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="Conectar.jsp"%>
<%@include file="valida.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Pet Social</title>
         <link rel="stylesheet" type="text/css" href="css/geral.css">
               <link rel="stylesheet" type="text/css" href="css/alterarDadosUsuario.css">
                            <script type="text/javascript">
            function  data(){
              
           var data=document.getElementById('dt').value;
                
                    if((data.length)==2){
                        
                      document.getElementById('dt').value=document.getElementById('dt').value+"/";
                    }
                if((document.getElementById('dt').value.length)==5){
                        
                      document.getElementById('dt').value=document.getElementById('dt').value+"/";
                    }
            }
            
            
           function  tamanhoSenha(){
                var senha= document.getElementById('senha').value;
                var i=0;
                
                    if(senha.length <8){
                        
                        document.getElementById('senha').style.cssText="background-color:red;";
                       
                    }
                    
                    if(senha.length >=8){
                        
                        document.getElementById('senha').style.cssText="background-color:white;";
                      
                    }
                
            }
            
            function  telefone(){
              
      
                if((document.getElementById('tf').value.length)==0){
                        
                      document.getElementById('tf').value=document.getElementById('tf').value+"(";
                    }
                if((document.getElementById('tf').value.length)==3){
                        
                      document.getElementById('tf').value=document.getElementById('tf').value+")";
                    }
                     if((document.getElementById('tf').value.length)==8){
                        
                      document.getElementById('tf').value=document.getElementById('tf').value+"-";
                    }
                  
                                
            }
        
          function  celular(){
              
      
                if((document.getElementById('cl').value.length)==0){
                        
                      document.getElementById('cl').value=document.getElementById('cl').value+"(";
                    }
                if((document.getElementById('cl').value.length)==3){
                        
                      document.getElementById('cl').value=document.getElementById('cl').value+")";
                    }
                     if((document.getElementById('cl').value.length)==5){
                        
                      document.getElementById('cl').value=document.getElementById('cl').value+"-";
                    }
                    if((document.getElementById('cl').value.length)==10){
                        
                      document.getElementById('cl').value=document.getElementById('cl').value+"-";
                    }
                  
                                
            }
            
            function Cep(){
                 if((document.getElementById('cep').value.length)==2){
                        
                      document.getElementById('cep').value=document.getElementById('cep').value+".";
                    }
                if((document.getElementById('cep').value.length)==6){
                        
                      document.getElementById('cep').value=document.getElementById('cep').value+"-";
                    }
                     
            } 
            
            function Cpf(){
                 if((document.getElementById('cpf').value.length)==3){
                        
                      document.getElementById('cpf').value=document.getElementById('cpf').value+".";
                    }
                if((document.getElementById('cpf').value.length)==7){
                        
                      document.getElementById('cpf').value=document.getElementById('cpf').value+".";
                    }
                    
                    if((document.getElementById('cpf').value.length)==11){
                        
                      document.getElementById('cpf').value=document.getElementById('cpf').value+"-";
                    }
                     
            }
            
            
            function Rg(){
                 if((document.getElementById('rg').value.length)==2){
                        
                      document.getElementById('rg').value=document.getElementById('rg').value+".";
                    }
                if((document.getElementById('rg').value.length)==6){
                        
                      document.getElementById('rg').value=document.getElementById('rg').value+".";
                    }
                    
                    if((document.getElementById('rg').value.length)==10){
                        
                      document.getElementById('rg').value=document.getElementById('rg').value+"-";
                    }
                     
            }
            
          function Email(){
              if((document.getElementById('email1').value)!=(document.getElementById('email2').value)){
                        
                      document.getElementById('email2').style.cssText="background-color:red";
                      
                      alert('Os campos digitados não coincidem!');
                      
                    }
                    
                    if((document.getElementById('email1').value)==(document.getElementById('email2').value)){
                        
                      document.getElementById('email2').style.cssText="background-color:white";
                      
                    }
          }
          
          function Senha(){
               if((document.getElementById('senha').value)!=(document.getElementById('senha2').value)){
                        
                      document.getElementById('senha2').style.cssText="background-color:red";
                      
                      alert('As senhas  não coincidem!');
                      
                    }
                    
                    if((document.getElementById('senha').value)==(document.getElementById('senha2').value)){
                        
                      document.getElementById('senha2').style.cssText="background-color:white";
                      
                    }
          }
         </script>
    </head>
     <body>
         <img id="esquerda" src="img/azul1.jpg"/>
         <img id="direita" src="img/azul1.jpg"/>
        
	  <div id="barraMenu">
              <label id="pet">pet</label> <label id="social">Social</label>
              <div id="identidade"><label class="fonteLogin"> ALTERAR DADOS CADASTRAIS:</label><a href="perfil.jsp" id="sair"> Voltar</a> </div>
          </div> 
	    <!-- div que limita o tamanho do corpo do documento em 1024 X 768-->
	   <div id="corpo">
	    
		
		     <div id="cadastro">
                         <form action="atualiza.jsp" method="post">
			   <table  id="tabela" border="0"  >
                              
                               <tr><td class="tds"><label class="fonteCadastro">Nome:</label><input type="text"  class="text" name="TXTNM" value="<%out.println(session.getAttribute("nome"));%>" maxlength="50" /></td>
                                   <td class="tds" colspan="2"><label class="fonteCadastro">Sobrenome:</label><input type="text"  class="text" name="TXTSNM" value="<%out.println(session.getAttribute("sobrenome"));%>" maxlength="50" /></td></tr>  
			  
                               
                               <tr><td class="tds" ><label class="fonteCadastro">CPF:</label><input type="text" id="txtcpf" class="text" id="txtcpf" name="TXTCPF" value="<%out.println(session.getAttribute("cpf"));%>" id="cpf" onkeypress="Cpf()" maxlength="14"/></td> 
                               <td class="tds"><label class="fonteCadastro">RG:</label><input type="text"  class="text" name="TXTRG" value="<%out.println(session.getAttribute("rg"));%>" id="rg" onkeypress="Rg()" maxlength="12"/></td> 
                               <td class="tds"><label class="fonteCadastro"> Data de Nascimento:</label><input type="text" id="data" class="text" name="TXTNASCIMENTO" value="<%out.println(session.getAttribute("nascimento"));%>" id="dt" onkeypress="data()" maxlength="10"/></td></tr>
                             <tr><td class="tds" colspan="3"><label class="fonteCadastro" >Cep:</label><input type="text" id="txtcep" class="text" name="TXTCEP" value="<%out.println(session.getAttribute("cep"));%>"  id="cep" onkeypress="Cep()" maxlength="10"/></td> 
                           <tr><td class="tds" colspan="2"><label class="fonteCadastro" >Endereço:</label><input type="text"  class="text" name="TXTENDERECO" value="<%out.println(session.getAttribute("endereco"));%>" maxlength="50"/></td> 
                           <td class="tds"><label class="fonteCadastro">Numero:</label><input type="text"  class="text" name="TXTNUMERO" value="<%out.println(session.getAttribute("numero"));%>" /></td> </tr>
                           
                           <tr><td class="tds" colspan="3"><label class="fonteCadastro">Complemento:</label><input type="text"  class="text" name="TXTCOMPLEMENTO" value="<%out.println(session.getAttribute("complemento"));%>"  maxlength="50"/></td> </tr>
                           
                           <tr><td class="tds"><label class="fonteCadastro">Bairro:</label><input type="text"  class="text" name="TXTBAIRRO"  id="txtbairro"value="<%out.println(session.getAttribute("bairro"));%>" maxlength="50" /></td> 
                           <td class="tds"><label class="fonteCadastro">Cidade:</label><input type="text"  class="text" name="TXTCIDADE" value="<%out.println(session.getAttribute("cidade"));%>"  maxlength="50"/></td> 
                           <td class="tds"><label class="fonteCadastro">Estado:</label><input type="text"  class="text" name="TXTESTADO" value="<%out.println(session.getAttribute("estado"));%>" maxlength="50"/></td> </tr>
                        
                       
                          
                           
                           <tr><td class="tds" colspan="2"><label class="fonte2">Telefone :</label><input type="text" id="txttelefone" class="text" name="TXTTELEFONE" value="<%out.println(session.getAttribute("telefone1"));%>" id="tf" onkeypress="telefone()" maxlength="13"/></td> 
                               <td class="tds"><label class="fonte2">Celular:</label><input type="text"  class="text" name="TXTTELEFONE2" value="<%out.println(session.getAttribute("telefone2"));%>" id="cl"  onkeypress="celular()" maxlength="15"/></td> </tr>
                         
                           <tr><td id="tabelaTituloCadastro" class="tds" colspan="3"><input type="submit"  value="Alterar" id="sub"></td> </tr>
                          
                               
			   
			   
                           </table>
		     
                         </form>
			 
	   		
	   </div>
	                      
   </body>
</html>
